#include <iostream>

class Base
{
public:
    virtual Base *clone() = 0;
    virtual void show()
    {
        std::cout << "Base" << std::endl;
    }
};

class Derived : public Base
{
public:
    Base *clone()
    {
        return new Derived(*this);
    }

    void show()
    {
        std::cout << "Derived" << std::endl;
    }
};

int main()
{
    Base *ptr = new Derived;
    Base *p2 = ptr->clone();
    p2->show();
    return 0;
}